Test Failed
Push — master ( 0888ee...91d545 )
by Dmytro
02:36
created

ValidationError   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 14
c 0
b 0
f 0
rs 10

2 Functions

Rating   Name   Duplication   Size   Complexity  
A constructor 0 5 1
A toJSON 0 6 2
1
export default class ValidationError extends Error {
2
    constructor(cottus, errors) {
3
        super();
4
        this.cottus = cottus;
5
        this.errors = errors;
6
    }
7
8
    toJSON() {
9
        return {
10
            code    : 'VALIDATION_ERROR',
11
            details : this.errors.map(e => e.hash)
12
        };
13
    }
14
}
15